package com.kitty.game.equip.util;

public class EquipProductUtil {

    /**
     * 获取等级阶段
     *
     * @param level 等级
     */
    public static int getLevelStage(int level) {
        int stage = 70;
        if (level < 80) {
            return stage;
        } else {
            String levelStr = String.valueOf(level);
            stage = Integer.parseInt(levelStr.substring(0, levelStr.length() - 1) + "0");
        }
        return stage;
    }

    /**
     * 获取等级阶段
     *
     * @param level 等级
     */
    public static int getEquipProValue(boolean isAllPro, int level) {
        int stage = getLevelStage(level);
        int baseProValue;
        if (isAllPro) {
            baseProValue = 14;
        } else {
            baseProValue = 17;
        }
        if (stage > 70) {
            for (int i = 80; i <= stage; i += 10) {
                if (isAllPro) {
                    baseProValue += 2;
                } else {
                    if (i == 80 || i == 100 || i == 120) {
                        baseProValue += 3;
                    } else {
                        baseProValue += 2;
                    }
                }
            }
        }

        return baseProValue;
    }

     /**
     * 获取等级速度阶段
     *
     * @param level 等级
     */
    public static int getEquipSpeedValue(int level) {
        int stage = getLevelStage(level);
        int baseProValue = 90;
        if (stage > 70) {
            for (int i = 80; i <= stage; i += 10) {
                if (i == 90 || i == 120) {
                    baseProValue += 20;
                } else {
                    baseProValue += 10;
                }
            }
        }

        return baseProValue;
    }
    /**
     * 获取等级防御阶段
     *
     * @param level 等级
     */
    public static int getEquipDefValue(int level) {
        int stage = getLevelStage(level);
        int baseProValue = 200;
        if (stage > 70) {
            for (int i = 80; i <= stage; i += 10) {
                if (i == 90 || i == 120) {
                    baseProValue += 40;
                } else {
                    baseProValue += 20;
                }
            }
        }

        return baseProValue;
    }

    /**
     * 获取等级伤害阶段
     *
     * @param level 等级
     */
    public static int getEquipDamageValue(int level) {
        int stage = getLevelStage(level);
        int baseProValue = 1400;
        if (stage > 70) {
            for (int i = 80; i <= stage; i += 10) {
                if (i <= 90) {
                    baseProValue += 300;
                } else if (i <= 120) {
                    baseProValue += 400;
                } else if (i <= 130) {
                    baseProValue += 600;
                }else if (i <= 140) {
                    baseProValue += 400;
                }else if (i <= 150) {
                    baseProValue += 600;
                }else if (i <= 160) {
                    baseProValue += 650;
                }else if (i <= 170) {
                    baseProValue += 700;
                }
            }
        }

        return baseProValue;
    }

    public static void main(String[] args) {
        /**
         * 20 pu 100 shu
         */
        for (int i = 70; i <= 170; i += 10) {
            System.out.println("所有属性：" + i + "级 " + getEquipProValue(true, i));
        }
        System.out.println();
        for (int i = 70; i <= 170; i += 10) {
            System.out.println("普通属性：" + i + "级 " + getEquipProValue(false, i));
        }
        System.out.println();
        for (int i = 70; i <= 170; i += 10) {
            System.out.println("速度：" + i + "级 " + getEquipSpeedValue(i));
        }
        System.out.println();
        for (int i = 70; i <= 170; i += 10) {
            System.out.println("伤害：" + i + "级 " + getEquipDamageValue(i));
        }
    }

}
